<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>
<html>
<head>
    <title>考核项目明细</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">

    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link type="text/css" rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/css/base/base.css?20201106.1">

    <script src="/js/common/language.js"></script>

    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script src="/js/jquery/jquery.cookie.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script src="/js/base/base.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script type="text/javascript" charset="utf-8" src="/lib/pagination/js/jquery.pagination.min.js"></script>

    <%--<script src="/js/document/makeADraft.js"></script>--%>
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
    <style>

        table tr {
            border-width: 1px;
            border-style: solid;
            border-color: rgb(204, 204, 204);
            border-image: initial;
        }
        table tr th {
            font-size: 13pt;
            color: rgb(47, 92, 143);
            text-align: center;
            padding: 6px;
        }

        table  td {
            font-size: 11pt;
            padding: 6px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            word-break: keep-all;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }

        table tr:nth-child(2n) {
            background-color: rgb(255, 255, 255);
        }
        table tr:nth-child(2n+1) {
            background-color:#F6F7F9 ;
        }
        .newLeave {
            border-radius: 3px;
            margin-right: 3%;
            float: right;
            width: 70px;
            height: 28px;
            color: #fff;
            font-size: 14px;
            line-height: 28px;
            margin-right: 3%;
            margin-top: 8px;
            cursor: pointer;
            background: #2b7fe0
        }
        .clearfix {
            margin: 26px auto;
            width: 93%;
        }
        .clearfix input{
            width: 200px;
        }
        textarea.BigStatic {
            font-size: 10pt;
            padding: 1px 5px;
            border: 1px solid #C0BBB4;
            background: #E0E0E0;
            margin-left: 32px;
        }
        .index-desc{
            height: 95px;
            float: left;
            line-height: 95px;
            margin-right: 9px;
        }
        .lab-set{
            height: 50px;
            float: left;
            line-height: 47px;

        }
        #portalName{
            height: 30px;
            margin-right: 16px;
        }
        .li-set p{
            margin: 5px 0 0 103px;
        }
        .M-box3 .active {
            margin: 0px 3px;
            width: 38px;
            height: 38px;
            line-height: 38px;
            background: #2b7fe0;
            font-size: 12px;
            border: 1px solid #2b7fe0;
            color: #fff;
            text-align: center;
            display: inline-block;
        }
        .M-box3 {
            margin-top: 30px;
            position: fixed;
            bottom: 10px;
            right: 60px;
            text-align: center;
        }
        .M-box3 a {
            margin: 0 3px;
            width: 38px;
            height: 38px;
            line-height: 38px;
            font-size: 12px;
            display: inline-block;
            text-align: center;
            background: #fff;
            border: 1px solid #ebebeb;
            color: #333;
            text-decoration: none;
        }
        .jump-ipt {
            width: 38px;
            height: 38px;
            line-height: 38px;
            text-align: center;
            padding: 0;
        }
        .del{
            color: #e01919;
        }
        label{
            font-size: 14px;
        }
        .on{
            background: #D3E7FA !important;
        }
        /**去掉数字的上下箭头*/
        input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
            -webkit-appearance: none;
        }
        input[type="number"] {
            -moz-appearance: textfield;
        }
    </style>
</head>
<body>
<div class="headTop" id="maintop">
    <div class="headImg">
        <img src="/img/kaohesheding.png" alt="">
    </div>
    <div class="divTitle">
        考核项目明细
    </div>

    <div class="newLeave" id="busTravelData1" >
        <span style="margin-left: 26px;" id="back" class="btn">
            <img style="margin-right: 4px;margin-left: -16px;margin-bottom: 2px;" src="../../img/newfanhui.png" >
            返回</span>
    </div>
    <%--<input type="submit" value="新建" id="newBtn1" class="btn">--%>
    <div class="newLeave" id="busTravelData"  style="width: 100px;">
        <span style="margin-left: 26px;" id="newBtn1" class="btn">
            <img style="margin-right: 4px;margin-left: -16px;margin-bottom: 2px;" src="../../img/mywork/newbuildworjk.png" >
            新建明细</span>

    </div>
    <div class="newLeave" id="busTravelData2" style="width: 100px;">
        <span style="margin-left: 26px;" id="newBtn2" class="btn">
            <img style="margin-right: 4px;margin-left: -16px;margin-bottom: 2px;" src="../../img/mywork/newbuildworjk.png" >
            新建分类</span>

    </div>

</div>
<div id="beikaoList" style="float: left">
    <table style="margin-top: 65px;float: left;width:310px;margin-left: 20px">
        <thead>
        <tr style="background: none">
            <th style="">指标集分类</th>
            <th style="">权重</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="taskBody">

        </tbody>
    </table>
</div>
<div id="tab-box" style="float: left;width: 700px;margin-left: 70px" >
    <table style="margin:65px auto;width:95%" >
        <thead>
        <tr style="background: none">
            <th>考核项目</th>
            <th>权重</th>
            <%--<th>分值范围</th>--%>
            <th>分值说明</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="mingxi">

        </tbody>
    </table>
</div>
<div id="dbgz_page" class="M-box3">
</div>
<script>
    var groupId= getRequest().groupId;
    var name=$(this).parents('tr').attr("typeid");

    var detilFlag= getRequest().flag;
    var displayStr = '';
    if(detilFlag=='detail'){
        $('.newLeave').hide();
        $('#busTravelData1').show();
        displayStr = 'display:none;'
    }

    $.ajax({
        type:'get',
        url:'/ScoreGroupLeader/selScoreGroup',
        dataType:'json',
        data:{
            page:1,//当前处于第几页
            pageSize:5,//一页显示几条
            useFlag:false,
            typeId:groupId,
        },
        success:function(res){
            if(res){
                var str='';
                var strt='';
                $.each(res.obj, function (index, item) {
                    str += '<tr typeId="'+item.groupId+'">' +
                        '<td title="'+item.groupName +'">' +
                        '<a href="javascript:;" class="fenlei">'+item.groupName+'</a>'+
                        '</td>' +
                        '<td title="'+item.weight*100+'%' +'">' + undefindData(item.weight)*100+'%' + '</td>' +
                        '<td><span style="color:red;cursor: pointer;'+displayStr+'" class="deleteType">删除</span></td>'+
                        '</tr>';
                })
                $('#taskBody').html(str);
                //$('.fenlei').eq(0).parents('tr').addClass('on');
//                layer.closeAll();
//                me.pageTwo(res.totleNum,me.data.pageSize,me.data.page)
            }else{
            }
        }
    });
    //删除分类
    $('#taskBody').on('click', '.deleteType', function () {
        var typeId = $(this).parent().parent().attr('typeId');
        layer.open({
            type: 1,
            title: ['提示','background-color:#2e8ded;color:#fff'],
            content:'<div style="text-align: center;margin-top: 18px;">确认删除吗？</div>',
            area: ['200px', '160px'],
            btn: ['确认','取消'],
            yes:function(index){
                $.ajax({
                    url:'/ScoreGroupLeader/delScoreGroupById',
                    type:'post',
                    data:{
                        groupId:typeId
                    },
                    dataType:'json',
                    success:function(res){
                        layer.close(index);
                        if(res){
                            layer.msg("删除成功",{
                                icon: 1,
                                time: 1500 //2秒关闭（如果不配置，默认是3秒）
                            },function(){
                                location.reload();
                            })
                        }else {
                            layer.msg("删除失败",{
                                icon: 2,
                                time: 1500 //2秒关闭（如果不配置，默认是3秒）
                            },function(){

                            })
                        }
                    }
                })
            },
            btn2: function (index) {
                layer.close(index)
            },
            btnAlign:'c',

        })
    });
    //点击分类
    $('#taskBody').on('click', '.fenlei', function () {
        $(this).parent().parent().addClass('on');
        $(this).parent().parent().siblings().removeClass('on');
        var typeId = $(this).parent().parent().attr('typeId');
        name=$(this).parent().parent().attr('typeid');
        $.ajax({
            type:'get',
            url:'/ScoreItemLeader/selScoreItem',
            dataType:'json',
            data:{
                groupId:groupId,
                type: typeId,
            },
            success:function(res){
                var str='';
                $.each(res.obj, function (index, item) {
                    str += '<tr itemId="'+item.itemId+'"  groupId="'+item.groupId+'">' +
                        '<td title="'+item.itemName +'">' + item.itemName + '</td>' +
                        '<td title="'+item.weight +'">' + undefindData(item.weight)*100+'%' + '</td>' +
                        // '<td>' + item.min+ '~ '+item.max+'</td>' +
                        '<td>' +undefindData(item.itemExplain) + '</td>' +
                        '<td>' +
                        '<a class="bianji" href="javascript:;" style="margin-right: 10px;'+displayStr+'">修改</a>' +
                        '<a class="del" href="javascript:;" style="margin-right: 10px;'+displayStr+'">删除</a></td>' +
                        '</tr>';
                })
                $('#mingxi').html(str)
                layer.closeAll();
//                me.pageTwo(res.totleNum,me.data.pageSize,me.data.page)
            }
        })
    });
    //返回
    $('#back').click(function(){
        location.href="/ScoreGroupLeader/scoreGroup"
    })
    function getRequest() {
        var url = window.location.search; //获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for(var i = 0; i < strs.length; i ++) {
                theRequest[strs[i].split("=")[0]]=decodeURI(strs[i].split("=")[1]);
            }
        }
        return theRequest;
    }
    //列表带分页
    function undefindData(data) {
        if(data == undefined){
            return '';
        }else{
            return data;
        }
    }
    var ajaxPageTr={
        data:{
            page:1,//当前处于第几页
            pageSize:5,//一页显示几条
            useFlag:true,
            groupId:groupId
            // computationNumber:null
        },
        page:function () {
            var me=this;
            layer.msg('加载中', {
                icon: 16
                ,shade: 0.01
            });
            $.ajax({
                type:'get',
                url:'/ScoreItemLeader/selScoreItem?groupId='+groupId,
                dataType:'json',
                data:me.data,
                success:function(res){
                    var str='';
                    $.each(res.obj, function (index, item) {
                        str += '<tr itemId="'+item.itemId+'"  groupId="'+item.groupId+'">' +
                            '<td title="'+item.itemName +'">' + item.itemName + '</td>' +
                            '<td title="'+item.weight +'">' + undefindData(item.weight)*100+'%' + '</td>' +
                            // '<td>' + item.min+ '~ '+item.max+'</td>' +
                            '<td>' +undefindData(item.itemExplain) + '</td>' +
                            '<td>' +
                            '<a class="bianji" href="javascript:;"  style="margin-right: 10px;'+displayStr+'">修改</a>' +
                            '<a class="del" href="javascript:;"  style="margin-right: 10px;'+displayStr+'">删除</a></td>' +
                            '</tr>';
                    })
                    $('#mingxi').html(str)
                    layer.closeAll();
                    me.pageTwo(res.totleNum,me.data.pageSize,me.data.page)
                }
            })
        },
        pageTwo:function (totalData, pageSize,indexs) {
            var mes=this;
            $('#dbgz_page').pagination({
                totalData: totalData,
                showData: pageSize,
                prevContent:'上一页',
                nextContent:'下一页',
                jump: true,
                coping: true,
                homePage:'',
                endPage: '',
                current:indexs||1,
                callback: function (index) {
                    mes.data.page=index.getCurrent();
                    mes.page();
                }
            });
        }
    }
    ajaxPageTr.page();
    //删除
    $('table').on('click','.del',function(){
        var itemId=$(this).parent().parent().attr('itemId')
        layer.open({
            type: 1,
            title: ['提示','background-color:#2e8ded;color:#fff'],
            content:'<div style="text-align: center;margin-top: 18px;">确认删除吗？</div>',
            area: ['200px', '160px'],
            btn: ['确认','取消'],
            yes:function(index){
                $.ajax({
                    url:'/ScoreItemLeader/delScoreItem?'+itemId,
                    type:'post',
                    data:{
                        'itemId':itemId,
                    },
                    dataType:'json',
                    success:function(res){
                        layer.close(index)
                        if(res){
                            layer.msg("删除成功",{
                                icon: 1,
                                time: 1500 //2秒关闭（如果不配置，默认是3秒）
                            },function(){
                                location.href='/ScoreItemLeader/assessmentmingxi?groupId='+groupId;
                            })
                        }else {
                            layer.msg("删除失败",{
                                icon: 2,
                                time: 1500 //2秒关闭（如果不配置，默认是3秒）
                            },function(){
                                location.href='/ScoreItemLeader/assessmentmingxi?groupId='+groupId;
                            })
                        }
                    }
                })
            },
            btn2: function (index) {
                layer.close(index)
            },
            btnAlign:'c',
        })
    });
    //新建明细
    $('#busTravelData').click(function () {
        layer.open({
            type: 1,
            title: ['考核指标集明细', 'background-color:#2b7fe0;color:#fff;'],
            area: ['350px', '330px'],
            shadeClose: false, //点击遮罩关闭
            content:'<ul style="margin-top: 20px">' +
            '<li class="clearfix">' +
            '<label><span style="color:#e4393c">*</span>考核项目：</label><input id="portalName" type="text" name="portalName" value="" maxlength="25">' +
            '</li>'+
            '<li class="clearfix">' +
            '<label><span style="color:#e4393c">*</span> 考核指标集分类：</label>' +
            '<select style="margin-left: 10px; background: white; width:170px;height: 28px;" name="fenlei" id="fenlei" style="background: white; width:170px;height: 28px;" title=""></select>' +
            '</li>' +
            '<li class="clearfix" style="display:none">'+ // 隐藏传值 现在默认都是100分了
            '<label><span style="color:#e4393c">*</span>分值范围：</label><input style="width: 84px;height: 30px; margin-right: 10px" id="portalFanwei" type="text" name="portalName" value="1" maxlength="25">~<input style="width: 84px; height: 30px;margin-left: 10px" id="portalFanwei1" type="text" name="portalName" value="100" maxlength="25">' +
            '</li>'+
            '<li class="clearfix">'+
            '<label style="float: left;height:40px;line-height: 40px"><span style="color:#e4393c"></span>&nbsp分值说明：</label><textarea class="text-desc" name="portalMark" id="portalMark" cols="30" rows="3" style="margin-left: 4px"></textarea>' +
            '</li>'+
            '<li class="clearfix">'+
            '<label style="float: left;height:34px;line-height: 34px">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp权重：</label><input type="number" name="weight" id="weight" onblur="clearNoNum(this)"  style="height: 30px;line-height: 30px;border: 1px solid #ccc;" onmousewheel="stopScrollFun()" onDOMMouseScroll="stopScrollFun()" name="" placeholder="请输入小数">' +
            '</li>'+
            '</ul>',
            btn: ['保存', '取消'],
            success:function(){
                $.ajax({
                    type:'get',
                    url:'/ScoreGroupLeader/selScoreGroup',
                    dataType:'json',
                    data:{
                        page:1,//当前处于第几页
                        pageSize:5,//一页显示几条
                        useFlag:false,
                        typeId:groupId
                    },
                    success:function(res){
                        if(res){
                            var str='';
                            $.each(res.obj, function (index, item) {
                                if(item.groupId==name){
                                    str += '<option value="'+item.groupId+'" selected=selected>'  +
                                        item.groupName +
                                        '</option>';
                                }else{
                                    str += '<option value="'+item.groupId+'">'  +
                                        item.groupName +
                                        '</option>';
                                }
                            })
                            $('#fenlei').append(str);


                        }else{

                        }
                    }
                });
            },
            btn1: function (index) {
                if ($('#portalName').val() == '') {
                    layer.msg('请填写考核项目', {icon: 6});
                    return false;
                }
                if ($('#portalFanwei1').val() == '') {
                    layer.msg('请填写分值范围', {icon: 6});
                    return false;
                }
                if ($('#portalFanwei').val() == '') {
                    layer.msg('请填写分值范围', {icon: 6});
                    return false;
                }
                if ($('#portalFanwei').val() == '') {
                    layer.msg('请填写分值说明', {icon: 6});
                    return false;
                }
                var numval = parseInt($('#portalFanwei').val())
                var numval1 = parseInt($('#portalFanwei1').val())
                if (numval>=numval1) {
                    layer.msg('最小值大于了最大值', {icon: 6});
                    return false;
                }
                $.ajax({
                    type: 'post',
                    url: '/ScoreItemLeader/addScoreItem',
                    dataType: 'json',
                    data: {
                        groupId:groupId,
                        itemName: $('#portalName').val(),
                        max: $('#portalFanwei1').val(),
                        min: $('#portalFanwei').val(),
                        itemExplain: $('#portalMark').val(),
                        type: $('#fenlei option:selected').val(),
                        weight:$('#weight').val(),
                        /*sortNo: $('#sortNo').val(),
                         path: $('#path').val(),*/
                    },
                    success: function () {

                        layer.msg("保存成功", {
                            icon: 1,
                            time: 1500 //2秒关闭（如果不配置，默认是3秒）
                        }, function () {
                            location.reload();
                        });
                    }
                });
            }
        })

    });


    //新建分类
    $('#busTravelData2').click(function () {
        layer.open({
            type: 1,
            title: ['考核指标集分类', 'background-color:#2b7fe0;color:#fff;'],
            area: ['350px', '330px'],
            shadeClose: false, //点击遮罩关闭
            content:'<ul style="margin-top: 20px">' +
            '<li class="clearfix">' +
            '<label><span style="color:#e4393c">*</span>分类名称：</label><input id="portalName" type="text" name="portalName" value="" maxlength="25">' +
            '</li>'+
            '<li class="clearfix">'+
            '<label style="float: left;height:40px;line-height: 40px">&nbsp&nbsp分类描述：</label><textarea class="text-desc" name="portalMark" id="portalMark" cols="30" rows="3"></textarea>' +
            '</li>'+
            '<li class="clearfix">'+
            '<label style="float: left;height:34px;line-height: 34px">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp权重：</label><input type="number" name="weight" id="weight"  style="height: 30px;line-height: 30px;border: 1px solid #ccc;" onmousewheel="stopScrollFun()" onDOMMouseScroll="stopScrollFun()" name="" placeholder="请输入小数">' +
            '</li>'+
            '</ul>',
            btn: ['保存', '取消'],
            btn1: function (index) {
                if ($('#portalName').val() == '') {
                    layer.msg('请填写分类名称', {icon: 6});
                    return false;
                }
                $.ajax({
                    type: 'post',
                    url: '/ScoreGroupLeader/addScoreGroup',
                    dataType: 'json',
                    data: {
                        typeId:groupId,
                        groupName: $('#portalName').val(),
                        groupDesc: $('#portalMark').val(),
                        weight:$('#weight').val()
                    },
                    success: function () {
                        $.ajax({
                            type:'get',
                            url:'/ScoreGroupLeader/selScoreGroup',
                            dataType:'json',
                            data:{
                                page:1,//当前处于第几页
                                pageSize:5,//一页显示几条
                                useFlag:false,
                                typeId:1
                            },
                            success:function(res){
                                if(res){
                                    var str='';
                                    var strt='';
                                    $.each(res.obj, function (index, item) {
                                        str += '<option value="'+item.groupId+'">'  +
                                            item.groupName +
                                            '</option>';
                                    })
                                    $('#fenlei').html(str);

//                layer.closeAll();
//                me.pageTwo(res.totleNum,me.data.pageSize,me.data.page)
                                }else{

                                }
                            }
                        });
                        layer.msg("保存成功", {
                            icon: 1,
                            time: 1500 //2秒关闭（如果不配置，默认是3秒）
                        }, function () {
                            location.reload();
                        });
                    }
                });
            }
        })

    });
    function inputcheck(name,value) {
        $('#'+name+'').val(value)
    }
    //编辑
    $('table').on('click','.bianji',function() {
        var itemId = $(this).parent().parent().attr('itemId')
        /*var priveItem=$(this).parent().parent().attr('priveItem');*/
        /*window.location.href='/ScoreGroupLeader/assessmentbianji?groupId='+groupId;*/
        layer.open({
            type: 1,
            title: ['考核指标集明细', 'background-color:#2b7fe0;color:#fff;'],
            area: ['350px', '330px'],
            shadeClose: false, //点击遮罩关闭
            content: '<ul style="margin-top: 20px">' +
            '<li class="clearfix">' +
            '<label><span style="color:#e4393c">*</span>考核项目：</label><input id="portalName" type="text" name="portalName" value="" maxlength="25">' +
            '</li>' +
            '<li class="clearfix">' +
            '<label><span style="color:#e4393c">*</span> 考核指标集分类：</label>' +
            '<select style="margin-left: 10px; background: white; width:170px;height: 28px;" name="fenlei" id="fenlei" style="background: white; width:170px;height: 28px;" title=""></select>' +
            '</li>' +
            '<li class="clearfix"  style="display:none">' +
            '<label><span style="color:#e4393c">*</span>分值范围：</label><input style="width: 84px;height:30px;margin-right: 10px" id="portalFanwei1" type="text" name="portalName" value="" maxlength="25">~<input style="width: 84px;height:30px;margin-left: 10px" id="portalFanwei" type="text" name="portalName" value="" maxlength="25">' +
            '</li>' +
            '<li class="clearfix">' +
            '<label style="float: left;height:36px;line-height: 36px">&nbsp&nbsp分值说明：</label><textarea class="text-desc" name="portalMark" id="portalMark" cols="30" rows="3"></textarea>' +
            '</li>' +
            '<li class="clearfix">' +
            '<label style="float: left;height:34px;line-height: 34px">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp权重：</label><input type="text" onblur="clearNoNum(this)" name="weight" id="weight"  style="height: 30px;line-height: 30px;border: 1px solid #ccc;" onmousewheel="stopScrollFun()" onDOMMouseScroll="stopScrollFun()" name="" placeholder="请输入小数">' +
            '</li>' +
            '</ul>',

            btn: ['保存', '取消'],
            success:function(){
                $.ajax({
                    type:'get',
                    url:'/ScoreGroupLeader/selScoreGroup',
                    dataType:'json',
                    data:{
                        page:1,//当前处于第几页
                        pageSize:5,//一页显示几条
                        useFlag:false,
                        typeId:groupId
                    },
                    success:function(res){

                        if(res){
                            var str='';
                            $.each(res.obj, function (index, item) {
                                if(item.groupId==name){
                                    str += '<option value="'+item.groupId+'" selected=selected>'  +
                                        item.groupName +
                                        '</option>';
                                }else{
                                    str += '<option value="'+item.groupId+'">'  +
                                        item.groupName +
                                        '</option>';
                                }
                            })
                            $('#fenlei').append(str);
                        }else{

                        }
                        $.ajax({
                            type: 'post',
                            url: '/ScoreItemLeader/selScoreItem?itemId=' + itemId,
                            dataType: 'json',
                            data: {
                                groupId: groupId,
                                itemName: $('#portalName').val(),
                                max: $('#portalFanwei1').val(),
                                min: $('#portalFanwei').val(),
                                itemExplain: $('#portalMark').val(),
                                weight:$('#weight').val()
                            },
                            success: function (res) {
                                var objs = res.obj[0]
                                inputcheck('portalName', objs.itemName)
                                inputcheck('portalFanwei1', objs.min)
                                inputcheck('portalFanwei', objs.max)
                                inputcheck('portalMark', objs.itemExplain);
                                $('#fenlei').val(objs.type);
                                $('#weight').val(objs.weight);
                            }
                        });
                    }
                });
            },
            btn1: function (index) {
                if ($('#portalName').val() == '') {
                    layer.msg('请填写考核项目', {icon: 6});
                    return false;
                }
                if ($('#portalFanwei1').val() == '') {
                    layer.msg('请填写分值范围', {icon: 6});
                    return false;
                }
                if ($('#portalFanwei').val() == '') {
                    layer.msg('请填写分值范围', {icon: 6});
                    return false;
                }
                if ($('#portalFanwei').val() == '') {
                    layer.msg('请填写分值说明', {icon: 6});
                    return false;
                }
                var numval = parseInt($('#portalFanwei').val())
                var numval1 = parseInt($('#portalFanwei1').val())
                //   console.log(numval,numval1)
                if (numval1>=numval) {
                    layer.msg('最小值大于了最大值', {icon: 6});
                    return false;
                }
                var groupName = $('#portalName').val()
                var groupDesc = $('#portalMark').val()
                var deptNames = $('#deptNames').val()
                var query_toId = $('#query_toId').val()
                var userPrivInput = $('#userPrivInput').val()
                var weight = $('#weight').val()
                //   console.log(groupName, groupDesc, deptNames, query_toId, userPrivInput)
                $.ajax({
                    type: 'post',
                    url: '/ScoreItemLeader/modifyScoreItem?itemId=' + itemId,
                    dataType: 'json',
                    data: {
                        groupId: groupId,
                        itemName: $('#portalName').val(),
                        max: $('#portalFanwei').val(),
                        min: $('#portalFanwei1').val(),
                        itemExplain: $('#portalMark').val(),
                        type: $('#fenlei option:selected').val(),
                        weight:$('#weight').val()
                    },
                    success: function () {
                        layer.msg("修改成功", {
                            icon: 1,
                            time: 1500 //2秒关闭（如果不配置，默认是3秒）
                        }, function () {
                            location.href = '/ScoreItemLeader/assessmentmingxi?groupId=' + groupId;
                        });

                    }

                })
            }
        })
    })
    // 输入数字限制鼠标滚动方法
    function stopScrollFun(evt) {
        evt = evt || window.event;
        if(evt.preventDefault) {
            // Firefox
            evt.preventDefault();
            evt.stopPropagation();
        } else {
            // IE
            evt.cancelBubble=true;
            evt.returnValue = false;
        }
        return false;
    }
    function clearNoNum(obj) {
        obj.value = obj.value.replace(/[^\d.]/g, "");  //清除“数字”和“.”以外的字符
        obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
        obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
        obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');//只能输入两个小数
        if (obj.value.indexOf(".") < 0 && obj.value != "") {//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
            obj.value = parseFloat(obj.value);
        }
    }

    // function NumberCheck(num) {
    //     var str = num + '';
    //     var len1 = str.substr(0, 1);
    //     var len2 = str.substr(1, 1);
    //     //如果第一位是0，第二位不是点，就用数字把点替换掉
    //     if (str.length > 1 && len1 == 0 && len2 != ".") {
    //         str = str.substr(1, 1);
    //     }
    //     //第一位不能是.
    //     if (len1 == ".") {
    //         str = "";
    //     }
    //     //限制只能输入一个小数点
    //     if (str.indexOf(".") != -1) {
    //         var str_ = str.substr(str.indexOf(".") + 1);
    //         if (str_.indexOf(".") != -1) {
    //             str = str.substr(0, str.indexOf(".") + str_.indexOf(".") + 1);
    //         }
    //     }
    //     //正则替换，保留数字和小数点
    //     str = str.replace(/[^\d^\.]+/g,'')
    //     //如果需要保留小数点后两位，则用下面公式
    //     // str = str.replace(/\.\d\d$/,'')
    //     return str;}
</script>
</body>
</html>
